package cn.kami.dao.proxy;

import java.util.List;

import cn.kami.dao.IBatteryVersionDAO;
import cn.kami.dao.impl.BatteryVersionDAOImpl;
import cn.kami.dbc.DatabaseConnection;
import cn.kami.factory.DatabaseConnectionFactory;
import cn.kami.vo.BatteryVersion;

public class BatteryVersionDAOProxy implements IBatteryVersionDAO {
	private DatabaseConnection dbc = null;
	private BatteryVersionDAOImpl dao = null;
	public BatteryVersionDAOProxy()throws Exception{
		this.dbc = DatabaseConnectionFactory.getOracleDatabaseConnection();
		this.dao = new BatteryVersionDAOImpl(this.dbc.getConnection());
	}
	@Override
	public List<BatteryVersion> findAllVersionName() throws Exception {
		// TODO Auto-generated method stub
		List<BatteryVersion> all = null;
		try{
			all = this.dao.findAllVersionName();
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return all;
	}

	@Override
	public BatteryVersion findByVersion(String version) throws Exception {
		// TODO Auto-generated method stub
		BatteryVersion batVersion = null;
		try{
			batVersion = this.dao.findByVersion(version);
		}catch(Exception e){
			throw e;
		}finally{
			this.dbc.close();
		}
		return batVersion;
	}

}
